module BarsHelper
  
  def guests_online
    BarGuest.find_by_sql("select u.* from bar_guests as bg left join users as u " + 
                         "on u.id = bg.user_id where u.status = 1 and bg.bar_id = #{params[:id]}")
  end
  
  def count_online_guests
    BarGuest.count_by_sql("select count(*) from bar_guests as bg left join users as u " + 
                          "on u.id = bg.user_id where u.status = 1 and bg.bar_id = #{params[:id]}")
  end
end
